#include<iostream>
#include<vector>
using namespace std;
vector<int>ans;
const int N = 1e5 + 10;
int w[N], q[N];
int n;
int len = 1;
int find(int x)
{
	int l = 0, r = len + 1;
	while (l + 1 < r) {
		int mid = l + r >> 1;
		if (q[mid] <= x)l = mid;
		else r = mid;
	}
	return r;
}
int find1(int x)
{
	int l = -1, r = ans.size();
	while (l + 1 < r) {
		int mid = l + r >> 1;
		if (ans[mid] <= x)l = mid;
		else r = mid;
	}
	return r;
}
int main()
{
	int x;
	while (cin >> x) {
		w[++n] = x;
	}
	q[1] = w[n];
	for (int i = n - 1; i >= 1; i--) {
		if (q[len] < w[i]) {
			q[++len] = w[i];
		}
		else {
			int idx = find(w[i]);
			q[idx] = w[i];
		}
	}
	int cnt = 0;
	ans[0] = w[1];
	for (int i = 2; i <= n; i++) {
		int idx = find1(w[i]);
		cout << "idx==" << idx << endl;
		if (idx >= 1 && idx <= n) {
			ans[idx] = w[i];
		}
		else {
			cnt++;
			ans.push_back(w[i]);
		}
	}
	cout << len << endl;
	cout << cnt << endl;
	return 0;
}